package com.hspedu.spring.factory;

import com.hspedu.spring.bean.Monster;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Charlie
 * @version 1.0
 * @date 31/10/2025 下午11:18
 */
public class MyStaticFactory {
    private static Map<String, Monster>monsterMap;

     static {
         monsterMap =new HashMap<>();
         monsterMap.put("monster01",new Monster("niu",100,"芭蕉扇"));
         monsterMap.put("monster02",new Monster("niu2",101,"芭蕉扇~"));

     }

     //提供一个方法放回monster对象
    public static Monster getMonster(String key){
         return monsterMap.get(key);
    }

}
